home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / anim / overattack.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  3.3 KB  |  142 lines

  1. //-----
  2. // Overattack.scr
  3. //-----
  4. // Script for attacking over an obstacle/cover
  5.  
  6. //println "overattack.scr called"
  7.  
  8. overattack:
  9.     waitexec anim/smoking.scr::SmokeRemoveCigarette
  10.     waitexec anim/reload.scr::ReloadInit
  11.  
  12.     self.painhandler = anim/overattack.scr::overattackpain
  13. //    self.deathhandler = anim/overattack.scr::overattackdeath
  14.     self.blendtime = 0.50
  15.     local.curpos = self.origin
  16.  
  17.  
  18.     if (self.position != crouch)
  19.         {
  20.         self setmotionanim (self.weapongroup + "_crate_standtocrouch")
  21.         self waittill flaggedanimdone
  22.         self.position = crouch
  23.         }
  24.  
  25.     // enter when crouching
  26.     while(1)
  27.         {
  28.         // alert here..
  29.         self setmotionanim (self.weapongroup + "_crate_alert")
  30.         local.randnum = randomint 1
  31.         wait local.randnum
  32.  
  33.         // Taunt the enemy
  34.         local.randnum = randomint 100
  35.         if (local.randnum<50)
  36.         {
  37. //            println "taunting from behind a crate"
  38.             self exec anim/say_taunt.scr
  39.         }
  40.  
  41.         local.randnum = (randomint 2) + 1
  42.         wait local.randnum
  43.  
  44.  
  45.         local.randnum = randomint 100
  46.         if (local.randnum>50)
  47.             {
  48.             switch (self.weapongroup)
  49.                 {
  50.                 case mp40:
  51.                 case mp44:
  52.                     if (self.roundsinclip > 0)
  53.                         {
  54.                         //unload the whole clip to the target
  55.                         self setmotionanim (self.weapongroup + "_crate_blindfire_intro")
  56.                         self waittill flaggedanimdone
  57.                         while (self.roundsinclip > 0)
  58.                             {
  59.                             self.origin = local.curpos
  60.                             self setmotionanim (self.weapongroup + "_crate_blindfire")
  61.                             self waittill flaggedanimdone
  62.                             self.roundsinclip = self.roundsinclip - 7
  63.                             }
  64.                         self.origin = local.curpos
  65.                         self setmotionanim (self.weapongroup + "_crate_blindfire_outtro")
  66.                         self waittill flaggedanimdone
  67.                         self.origin = local.curpos
  68.                         waitexec anim/reload.scr::Reload 1 0
  69.                         }
  70.                         else
  71.                         {
  72.                         self.origin = local.curpos
  73.                         waitexec anim/reload.scr::Reload 1 0
  74.                         }
  75.                     break
  76.                 default:
  77.                     self setmotionanim (self.weapongroup + "_crate_blindfire")
  78.                     self waittill flaggedanimdone
  79.                     self.origin = local.curpos
  80.                     waitexec anim/reload.scr::Reload 1 0
  81.                     break
  82.                 }
  83.             }
  84.         else
  85.             {
  86.             self setmotionanim (self.weapongroup + "_crate_crouchtostand")
  87.             self waittill flaggedanimdone
  88.  
  89.             // can we see enemy
  90.             if (self.enemy)
  91.                 {
  92.                 local.enemyseen = self cansee self.enemy
  93.                 }
  94.             else
  95.                 {
  96.                 local.enemyseen = 0
  97.                 }
  98.  
  99.             // standing fire at enemy
  100.             //if (local.enemyseen)
  101.                 //{
  102.                 local.rand = randomint 2 + 1
  103.                 while(local.rand>0)
  104.                     {
  105.                     self setmotionanim (self.weapongroup + "_crate_shoot")
  106.                     self waittill flaggedanimdone
  107.                     local.rand--
  108.                     self.origin = local.curpos
  109.                     waitexec anim/Reload.scr::CheckForCornerReload
  110.                     if (self.needreload == 1)
  111.                         {
  112.                             break
  113.                         }
  114.                     }
  115.                 //}
  116.  
  117.             self setmotionanim (self.weapongroup + "_crate_standtocrouch")
  118.             self waittill flaggedanimdone
  119.             waitexec anim/reload.scr::Reload 1 0
  120.             }
  121.         }
  122. end
  123.  
  124. /////////////////////
  125.  
  126. overattackpain:
  127.     waitexec anim/smoking.scr::SmokeRemoveCigarette
  128.     
  129.     self setmotionanim (self.weapongroup + "_crate_pain")
  130.     self waittill flaggedanimdone
  131. end
  132.  
  133. ////////////////////
  134.  
  135. overattackdeath:
  136.     waitexec anim/smoking.scr::SmokeRemoveCigarette
  137.     
  138.     self setmotionanim (self.weapongroup + "_crate_death")
  139.     self waittill flaggedanimdone
  140.     self.position = "dead"
  141. end
  142.